/********************************
 * ETK - Easy ToolKit
 * Copyright (C) 2007-2008 Ekinoks (scv.ekinoks@gmail.com)
 * All rights reserved.
 *
 *    This file is part of ETK.
 *
 *    Foobar is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 2 of the License, or
 *    (at your option) any later version.
 *
 *    Foobar is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with Foobar; if not, write to the Free Software
 *    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 ***********************************************************************************/

#ifndef __ETK_TOFUNCTION_H__
#define __ETK_TOFUNCTION_H__

#include <boost/function.hpp>
#include <boost/bind.hpp>



namespace etk
{
    /** Pour trouver le type de boost::function (pour le _ME)
    *
    *
    */
    template <class E, class R>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(),
                                                boost::_bi::list0
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class B1>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1),
                                                boost::_bi::list1<B1 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class> class MF, class A1, class B1>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1>,
                                                boost::_bi::list1<B1 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1),
                                                boost::_bi::list1<boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class> class MF, class A1>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1>,
                                                boost::_bi::list1<boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class B1, class B2>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2),
                                                boost::_bi::list2<B1, B2 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class> class MF, class A1, class A2, class B1, class B2>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2>,
                                                boost::_bi::list2<B1, B2 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class B1>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2),
                                                boost::_bi::list2<boost::arg<1> (*)(), B1 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class> class MF, class A1, class A2, class B1>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2>,
                                                boost::_bi::list2<boost::arg<1> (*)(), B1 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class B1>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2),
                                                boost::_bi::list2<B1, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class> class MF, class A1, class A2, class B1>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2>,
                                                boost::_bi::list2<B1, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class B1, class B2, class B3>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3),
                                                boost::_bi::list3<B1, B2, B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class> class MF, class A1, class A2, class A3, class B1, class B2, class B3>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3>,
                                                boost::_bi::list3<B1, B2, B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class B1, class B2>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3),
                                                boost::_bi::list3<boost::arg<1> (*)(), B1, B2 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class> class MF, class A1, class A2, class A3, class B1, class B2>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3>,
                                                boost::_bi::list3<boost::arg<1> (*)(), B1, B2 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class B1, class B2>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3),
                                                boost::_bi::list3<B1, boost::arg<1> (*)(), B2 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class> class MF, class A1, class A2, class A3, class B1, class B2>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3>,
                                                boost::_bi::list3<B1, boost::arg<1> (*)(), B2 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class B1, class B2>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3),
                                                boost::_bi::list3<B1, B2, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class> class MF, class A1, class A2, class A3, class B1, class B2>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3>,
                                                boost::_bi::list3<B1, B2, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4),
                                                boost::_bi::list4<B1, B2, B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4>,
                                                boost::_bi::list4<B1, B2, B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4),
                                                boost::_bi::list4<boost::arg<1> (*)(), B1, B2, B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4>,
                                                boost::_bi::list4<boost::arg<1> (*)(), B1, B2, B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4),
                                                boost::_bi::list4<B1, boost::arg<1> (*)(), B2, B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4>,
                                                boost::_bi::list4<B1, boost::arg<1> (*)(), B2, B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4),
                                                boost::_bi::list4<B1, B2, boost::arg<1> (*)(), B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4>,
                                                boost::_bi::list4<B1, B2, boost::arg<1> (*)(), B3 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4),
                                                boost::_bi::list4<B1, B2, B3, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class B1, class B2, class B3>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4>,
                                                boost::_bi::list4<B1, B2, B3, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5),
                                                boost::_bi::list5<B1, B2, B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5>,
                                                boost::_bi::list5<B1, B2, B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5),
                                                boost::_bi::list5<boost::arg<1> (*)(), B1, B2, B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5>,
                                                boost::_bi::list5<boost::arg<1> (*)(), B1, B2, B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5),
                                                boost::_bi::list5<B1, boost::arg<1> (*)(), B2, B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5>,
                                                boost::_bi::list5<B1, boost::arg<1> (*)(), B2, B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5),
                                                boost::_bi::list5<B1, B2, boost::arg<1> (*)(), B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5>,
                                                boost::_bi::list5<B1, B2, boost::arg<1> (*)(), B3, B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5),
                                                boost::_bi::list5<B1, B2, B3, boost::arg<1> (*)(), B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5>,
                                                boost::_bi::list5<B1, B2, B3, boost::arg<1> (*)(), B4 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5),
                                                boost::_bi::list5<B1, B2, B3, B4, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class B1, class B2, class B3, class B4>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5>,
                                                boost::_bi::list5<B1, B2, B3, B4, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6),
                                                boost::_bi::list6<B1, B2, B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6>,
                                                boost::_bi::list6<B1, B2, B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6),
                                                boost::_bi::list6<boost::arg<1> (*)(), B1, B2, B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6>,
                                                boost::_bi::list6<boost::arg<1> (*)(), B1, B2, B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6),
                                                boost::_bi::list6<B1, boost::arg<1> (*)(), B2, B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6>,
                                                boost::_bi::list6<B1, boost::arg<1> (*)(), B2, B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6),
                                                boost::_bi::list6<B1, B2, boost::arg<1> (*)(), B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6>,
                                                boost::_bi::list6<B1, B2, boost::arg<1> (*)(), B3, B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6),
                                                boost::_bi::list6<B1, B2, B3, boost::arg<1> (*)(), B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6>,
                                                boost::_bi::list6<B1, B2, B3, boost::arg<1> (*)(), B4, B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6),
                                                boost::_bi::list6<B1, B2, B3, B4, boost::arg<1> (*)(), B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6>,
                                                boost::_bi::list6<B1, B2, B3, B4, boost::arg<1> (*)(), B5 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A6, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6),
                                                boost::_bi::list6<B1, B2, B3, B4, B5, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class B1, class B2, class B3, class B4, class B5>
    inline boost::function2 <void, A6, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6>,
                                                boost::_bi::list6<B1, B2, B3, B4, B5, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<B1, B2, B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<B1, B2, B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<boost::arg<1> (*)(), B1, B2, B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<boost::arg<1> (*)(), B1, B2, B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<B1, boost::arg<1> (*)(), B2, B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<B1, boost::arg<1> (*)(), B2, B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<B1, B2, boost::arg<1> (*)(), B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<B1, B2, boost::arg<1> (*)(), B3, B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<B1, B2, B3, boost::arg<1> (*)(), B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<B1, B2, B3, boost::arg<1> (*)(), B4, B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<B1, B2, B3, B4, boost::arg<1> (*)(), B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<B1, B2, B3, B4, boost::arg<1> (*)(), B5, B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A6, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<B1, B2, B3, B4, B5, boost::arg<1> (*)(), B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A6, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<B1, B2, B3, B4, B5, boost::arg<1> (*)(), B6 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A7, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7),
                                                boost::_bi::list7<B1, B2, B3, B4, B5, B6, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class B1, class B2, class B3, class B4, class B5, class B6>
    inline boost::function2 <void, A7, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7>,
                                                boost::_bi::list7<B1, B2, B3, B4, B5, B6, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, B2, B3, B4, B5, B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, B2, B3, B4, B5, B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<boost::arg<1> (*)(), B1, B2, B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A1*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<boost::arg<1> (*)(), B1, B2, B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, boost::arg<1> (*)(), B2, B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, boost::arg<1> (*)(), B2, B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, B2, boost::arg<1> (*)(), B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, B2, boost::arg<1> (*)(), B3, B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, B2, B3, boost::arg<1> (*)(), B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, B2, B3, boost::arg<1> (*)(), B4, B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, B2, B3, B4, boost::arg<1> (*)(), B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, B2, B3, B4, boost::arg<1> (*)(), B5, B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A6, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, B2, B3, B4, B5, boost::arg<1> (*)(), B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A6, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, B2, B3, B4, B5, boost::arg<1> (*)(), B6, B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A7, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, B2, B3, B4, B5, B6, boost::arg<1> (*)(), B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A7, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, B2, B3, B4, B5, B6, boost::arg<1> (*)(), B7 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A8, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8),
                                                boost::_bi::list8<B1, B2, B3, B4, B5, B6, B7, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, template <class, class, class, class, class, class, class, class, class> class MF, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class B1, class B2, class B3, class B4, class B5, class B6, class B7>
    inline boost::function2 <void, A8, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                MF<R, A1, A2, A3, A4, A5, A6, A7, A8>,
                                                boost::_bi::list8<B1, B2, B3, B4, B5, B6, B7, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8, class B9>
    inline boost::function2 <void, Widget*, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, B3, B4, B5, B6, B7, B8, B9 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A1, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<boost::arg<1> (*)(), B1, B2, B3, B4, B5, B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A2, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, boost::arg<1> (*)(), B2, B3, B4, B5, B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A3, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, boost::arg<1> (*)(), B3, B4, B5, B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A4, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, B3, boost::arg<1> (*)(), B4, B5, B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A5, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, B3, B4, boost::arg<1> (*)(), B5, B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A6, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, B3, B4, B5, boost::arg<1> (*)(), B6, B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A7, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, B3, B4, B5, B6, boost::arg<1> (*)(), B7, B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A8, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, B3, B4, B5, B6, B7, boost::arg<1> (*)(), B8 >
                                            > b, E* )
    {
        return b;
    }

    template <class E, class R, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class B1, class B2, class B3, class B4, class B5, class B6, class B7, class B8>
    inline boost::function2 <void, A9, E> toFunction( boost::_bi::bind_t	<
                                                R,
                                                R (*)(A1, A2, A3, A4, A5, A6, A7, A8, A9),
                                                boost::_bi::list9<B1, B2, B3, B4, B5, B6, B7, B8, boost::arg<1> (*)() >
                                            > b, E* )
    {
        return b;
    }
}

#endif /* #ifndef __ETK_TOFUNCTION_H__ */
